import router from './router'
import Cookies from 'js-cookie'
router.beforeEach(async (to, from, next) => {
    //debugger
    if (Cookies.get('tmp-token') && to.params.id) {
        next()
    } else {
        if (!to.params.id) return
        if (to.params.id && !to.query.st) {
            window.location.href = `https://olpassport.5211game.com/Login?siteid=50008&returnUrl=${escape(window.location.href)}&srvid=7`
        } else if (to.params.id && to.query.st) {
            Cookies.set('tmp-token', to.query.st)
            next({ path: `/${to.params.id}` })
        }
    }

})